package com.woniuxy.mini;

import com.woniuxy.core.service.UserStatsService;
import com.woniuxy.util.ResponseData;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 饶志
 * @version 1.0
 * @since 2025-07-17  10:24
 */
@RestController
@RequestMapping("/user/stats")
@RequiredArgsConstructor
public class UserStatsController {

    private final UserStatsService userStatsService;

    @PostMapping("/incrementPostCount/{userId}")
    public ResponseData<Void> incrementPostCount(@PathVariable("userId") Long userId) {
        userStatsService.incrementPostCount(userId);
        return ResponseData.ok();
    }

    @PostMapping("/decrementPostCount/{userId}")
    public ResponseData<Void> decrementPostCount(@PathVariable("userId") Long userId) {
        userStatsService.decrementPostCount(userId);
        return ResponseData.ok();
    }
}
